package com.example.demo.controller;


import com.example.demo.common.Result;
import com.example.demo.service.SysTitleSubmitRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author ld&zjw
 * @since 2024-01-31
 */
@RestController
@RequestMapping("/submitRecord")
public class SysTitleSubmitRecordController {

    @Autowired
    SysTitleSubmitRecordService sysTitleSubmitRecordService;

    @GetMapping("/{id}")
    public Result<?> getById(@PathVariable Long id){
        return Result.success(sysTitleSubmitRecordService.getById(id));
    }

    @GetMapping("/ranking")
    public Result<?> findRankingPage(@RequestParam(defaultValue = "1") Integer pageNum,
                              @RequestParam(defaultValue = "10") Integer pageSize,
                              @RequestParam(defaultValue = "") String search) {
        return Result.success(sysTitleSubmitRecordService.findRankingPage(pageNum, pageSize, search));
    }

    @GetMapping("/status")
    public Result<?> findStatusPage(@RequestParam(defaultValue = "1") Integer pageNum,
                              @RequestParam(defaultValue = "10") Integer pageSize,
                              @RequestParam(defaultValue = "") String search) {
        return Result.success(sysTitleSubmitRecordService.findStatusPage(pageNum, pageSize, search));
    }

}

